home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 23 / CU Amiga - Super CD-ROM 23 (June 1998).iso / CUCD / Programming / OUI / include / rcs / window_inlines.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  6.0 KB  |  324 lines

  1. head    1.1;
  2. access;
  3. symbols;
  4. locks
  5.     dlorre:1.1; strict;
  6. comment    @ * @;
  7.  
  8.  
  9. 1.1
  10. date    97.07.14.04.24.06;    author dlorre;    state Exp;
  11. branches;
  12. next    ;
  13.  
  14.  
  15. desc
  16. @inlines conditionally included
  17. @
  18.  
  19.  
  20. 1.1
  21. log
  22. @Initial revision
  23. @
  24. text
  25. @// $Id$
  26. #if !defined( CLASS_WINDOW_INLINES_H )
  27. #define CLASS_WINDOW_INLINES_H
  28.  
  29. #include <stdio.h>
  30. #include <string.h>
  31.  
  32. #include <proto/exec.h>
  33. #include <proto/graphics.h>
  34. #include <proto/layers.h>
  35. #include <proto/intuition.h>
  36. #include <proto/gadtools.h>
  37. #include <proto/utility.h>
  38.  
  39. inline void window::setfunc(void (*func)(long , unsigned long, unsigned short))
  40. {
  41.     reqfunc = func ;
  42. }
  43.  
  44. inline void window::titles(const char *wt, const char *st)
  45. {
  46.     if (win) SetWindowTitles(win, (UBYTE *)wt, (UBYTE *)st) ;
  47. }
  48.  
  49. inline void window::activate()
  50. {
  51.     if (win) ActivateWindow(win) ;
  52. }
  53.  
  54. inline void window::front()
  55. {
  56.     if (win) WindowToFront(win) ;
  57. }
  58.  
  59. inline void window::back()
  60. {
  61.     if (win) WindowToBack(win) ;
  62. }
  63.  
  64. inline void window::resetidcmp()
  65. {
  66.     ModifyIDCMP(win, idcmp) ;
  67. }
  68.  
  69. inline void window::recessedbox(short x, short y, short w, short h)
  70. {
  71.     if (win)
  72.         DrawBevelBox(rp, x, y, w, h,
  73.         GT_VisualInfo, ws->vi,
  74.         GTBB_Recessed, TRUE,
  75.         TAG_END);
  76. }
  77.  
  78.  
  79. inline void window::bevelbox(short x, short y, short w, short h)
  80. {
  81.     if (win)
  82.         DrawBevelBox(rp, x, y, w, h,
  83.         GT_VisualInfo, ws->vi,
  84.         TAG_END);
  85. }
  86.  
  87.  
  88. inline MenuItem *window::itemaddress( unsigned long menuNumber )
  89. {
  90.     return ItemAddress( menu, menuNumber) ;
  91. }
  92.  
  93. inline MenuItem *window::itemaddress(LONG m, LONG i, LONG s)
  94. {
  95.     return ItemAddress(menu, FULLMENUNUM(m, i, s)) ;
  96. }
  97.  
  98. inline void window::clearmenustrip(void)
  99. {
  100.     ClearMenuStrip(win) ;
  101. }
  102.  
  103. inline BOOL window::resetmenustrip(void)
  104. {
  105.     return ResetMenuStrip(win, menu) ;
  106. }
  107.  
  108.  
  109. inline void window::draw(long x, long y)                       // Draw(rp, ...)
  110. {
  111.     Draw(rp, x, y) ;
  112. }
  113.  
  114. inline void window::polydraw(long count, WORD *polyTable)
  115. {
  116.     PolyDraw(rp, count, polyTable) ;
  117. }
  118.  
  119. inline void window::rectfill(long xMin, long yMin, long xMax, long yMax)
  120. {
  121.     RectFill(rp, xMin, yMin, xMax, yMax) ;
  122. }
  123.  
  124. inline void window::eraserect(long xMin, long yMin, long xMax, long yMax )
  125. {
  126.     EraseRect(rp, xMin, yMin, xMax, yMax) ;
  127. }
  128.  
  129. inline void window::setapen(unsigned long pen)
  130. {
  131.     SetAPen(rp, pen) ;
  132. }
  133.  
  134. inline void window::setbpen(unsigned long pen)
  135. {
  136.     SetBPen(rp, pen) ;
  137. }
  138.  
  139. inline void window::setopen(unsigned long pen)
  140. {
  141.     SafeSetOutlinePen(rp, char(pen)) ;
  142. }
  143.  
  144. inline void window::setrast(unsigned long pen)
  145. {
  146.     SetRast(rp, pen) ;
  147. }
  148.  
  149. inline void window::setdrmd(unsigned long drawMode)
  150. {
  151.     SetDrMd(rp, drawMode) ;
  152. }
  153.  
  154. inline void window::setdrpt(UWORD pattern)
  155. {
  156.     SetDrPt(rp, pattern) ;
  157. }
  158.  
  159. inline void window::setafpt(const UWORD *pattern, BYTE count)
  160. {
  161.     SetAfPt(rp, (UWORD *)pattern, count) ;
  162. }
  163.  
  164. inline short window::textlength(const char *string, unsigned long count )
  165. {
  166.     return TextLength(rp, STRPTR(string), count );
  167. }
  168.  
  169.  
  170. inline unsigned long window::textfit(const char *string, unsigned long strLen,
  171.     struct TextExtent *textExtent, struct TextExtent *constrainingExtent,
  172.     long strDirection, unsigned long constrainingBitWidth,
  173.     unsigned long constrainingBitHeight )
  174. {
  175.     return TextFit(rp, STRPTR(string), strLen, textExtent, constrainingExtent,
  176.         strDirection, constrainingBitWidth, constrainingBitHeight) ;
  177. }
  178.  
  179. inline void window::setfont(TextFont *font)
  180. {
  181.     SetFont( rp, font) ;
  182. }
  183.  
  184. // Intuition Drawing Routines
  185.  
  186. inline void window::printitext(IntuiText *iText, long left, long top )
  187. {
  188.     PrintIText( rp, iText, left, top) ;
  189. }
  190.  
  191. inline void window::drawborder( Border *border, long leftOffset, long topOffset )
  192. {
  193.     DrawBorder( rp, border, leftOffset, topOffset );
  194. }
  195.  
  196.  
  197. inline void window::drawimage( struct Image *image, long leftOffset, long topOffset )
  198. {
  199.     DrawImage( rp, image, leftOffset, topOffset );
  200. }
  201.  
  202. inline void window::eraseimage( struct Image *image, long leftOffset, long topOffset )
  203. {
  204.     EraseImage( rp, image, leftOffset,  topOffset );
  205. }
  206.  
  207. // Clip Routines
  208.  
  209. inline int window::newregion(void)
  210. {
  211.     clipregion = NewRegion() ;
  212.     if (clipregion) {
  213.         cliprect = new Rectangle ;
  214.         if (!cliprect) {
  215.             DisposeRegion( clipregion ) ;
  216.             clipregion = NULL ;
  217.         }
  218.     }
  219.  
  220.     return (clipregion != NULL) ;
  221. }
  222.  
  223. inline void window::disposeregion(void)
  224. {
  225.     delete cliprect ;
  226.     DisposeRegion( clipregion );
  227. }
  228.  
  229. inline BOOL window::addregion(short l, short t, short w, short h)
  230. {
  231.     cliprect->MinX = l ;
  232.     cliprect->MaxX = short(l+w) ;
  233.     cliprect->MinY = t ;
  234.     cliprect->MaxY = short(t+h) ;
  235.     return OrRectRegion(clipregion, cliprect) ;
  236. }
  237.  
  238. inline void window::installclip(void)
  239. {
  240.     InstallClipRegion(win->WLayer, clipregion) ;
  241. }
  242.  
  243. inline void window::removeclip(void)
  244. {
  245.     clipregion = InstallClipRegion(win->WLayer, NULL) ;
  246. }
  247.  
  248. // Pointer Routines
  249.  
  250. inline void window::setpointer( UWORD *pointer, long height,
  251.     long width, long xOffset, long yOffset )
  252. {
  253.     SetPointer(win, pointer, height, width, xOffset, yOffset) ;
  254. }
  255.  
  256. inline void window::clearpointer()
  257. {
  258.     ClearPointer(win) ;
  259. }
  260.  
  261. // Area Routines
  262.  
  263. inline long window::areaellipse(long xCenter, long yCenter, long a, long b )
  264. {
  265.     return AreaEllipse( rp, xCenter, yCenter, a, b ) ;
  266. }
  267.  
  268. inline long window::areamove( long x, long y )
  269. {
  270.     return AreaMove( rp, x, y );
  271. }
  272.  
  273. inline long window::areadraw( long x, long y )
  274. {
  275.     return AreaDraw( rp, x, y );
  276. }
  277.  
  278. inline long window::areaend()
  279. {
  280.     return AreaEnd( rp );
  281. }
  282.  
  283. inline BOOL window::flood( unsigned long mode, long x, long y )
  284. {
  285.     return Flood( rp, mode, x, y );
  286. }
  287.  
  288. // BackGround Drawing routines
  289.  
  290. inline void window::setbgrp(RastPort *brp)
  291. {
  292.     rp = bgrp = brp ;
  293.     bgbm = bgrp->BitMap ;
  294. }
  295.  
  296. inline void window::clearbgrp()
  297. {
  298.     rp = win->RPort ;
  299. }
  300.  
  301. inline void window::flushbg(int x, int y, int w, int h, int mode)
  302. {
  303.     BltBitMapRastPort(bgbm, 0, 0, win->RPort, x, y, w, h, mode);
  304. }
  305.  
  306. // Refresh routines
  307.  
  308. inline void window::beginrefresh()
  309. {
  310.     GT_BeginRefresh(win) ;
  311. }
  312.  
  313. inline void window::endrefresh(BOOL end)
  314. {
  315.     GT_EndRefresh(win, end) ;
  316. }
  317.  
  318. inline void window::refreshwindowframe()
  319. {
  320.     RefreshWindowFrame(win) ;
  321. }
  322. #endif
  323. @
  324.